package com.itheima.bos.service.base.impl;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.itheima.bos.dao.base.CourierRepository;
import com.itheima.bos.domain.base.Courier;
import com.itheima.bos.service.base.ICourierService;
@Service
@Transactional
public class CourierServiceImpl implements ICourierService {
	@Autowired
	private CourierRepository courierRepository;

	@Override
	@RequiresPermissions("courier_add")
	public void save(Courier c) {
		
		courierRepository.save(c);
		
	}

	@Override
	public Page<Courier> findPageQuery(Specification<Courier> specification,
			Pageable p) {
		
		 return courierRepository.findAll(specification,p);
	}

	@Override
	public void delBatch(String[] idArray) {
		//转换id
		for (String ids : idArray) {
			int id = Integer.parseInt(ids);
			courierRepository.updataDeltag(id);
		}
	}

	

	
	

	
	
}
